# Maintainer: Sarah Ottinger <schalaalexiazeal@gmail.com>

_realname=godot_headers
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=3.5.1
pkgrel=1
pkgdesc='Headers for the Godot API supplied by the GDNative module. (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64' 'mingw32')
msys2_references=(
  'aur: godot-headers'
)
url="https://www.godotengine.org/"
license=('MIT')
source=("https://github.com/godotengine/godot_headers/archive/godot-${pkgver}-stable.tar.gz")
sha256sums=('1c38268031425a4881c0d6d41926a0f1bf5847f05dc24c29332609e318276b6b')

prepare() {
  rm -rf "${_realname}-${pkgver}"
  mv "${_realname//_/-}-godot-${pkgver}-stable" "${_realname}-${pkgver}"
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"

  mkdir -p "${pkgdir}${MINGW_PREFIX}/include"
  find . -type f -name '*.h' -exec install -Dm644 {} "${pkgdir}${MINGW_PREFIX}/include/godot/"{} \;
  install -D -m644 LICENSE.md "${pkgdir}${MINGW_PREFIX}/share/licenses/godot_headers/LICENSE.md"
  install -D -m644 api.json "${pkgdir}${MINGW_PREFIX}/share/godot/api.json"
}
